package shuzu;

/**
 * 定义一个数组 包含元素分别是：3 / 22 / 55 / 12 / 5 / 9 / 43 / 24 / 99 / 67
 * 交换顺序
 */
public class Zuoye2_28_1 {

    public static void main(String[] args) {
        int[] array = {3, 22, 55, 12, 5, 9, 43, 24, 99, 67};

        for (int value : array) {
            System.out.println(value);

        }
        System.out.println("=====================");

        //方法1
        /*for (int min = 0, max = array.length - 1; min < max; min++, max--) {
            int temp = array[min];
            array[min] = array[max];
            array[max] = temp;
        }*/

        //方法2
        for (int i = 0; i < array.length; i++) {
            if (i <= array.length / 2.0) {
                int temp = array[i];
                array[i] = array[array.length - 1 - i];
                array[array.length - 1 - i] = temp;
            }
        }

        for (int i = 0; i < array.length; i++) {
            System.out.println(array[i]);
        }

    }
}
